package com.hunt.controller;

import com.hunt.model.entity.BannerUpload;
import com.hunt.service.AppBannerUploadService;
import com.hunt.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Api(value = "手机端banner模块")
@Controller
@RequestMapping("banner")
public class AppBannerController extends BaseController {

    @Autowired
    AppBannerUploadService appBannerUploadService;


    @ApiOperation(value = "获取最新四条banner", httpMethod = "GET", produces = "application/json", response = Result.class)
    @ResponseBody
    @RequestMapping(value = "findBannersNewest", method = RequestMethod.GET)
    public Result findBannersNewest(@RequestParam(required = false,defaultValue = "4") Integer size) {

        List<BannerUpload> bannersNewest = appBannerUploadService.findBannersNewest(size);

        return Result.success(bannersNewest);
    }
}